
//四级菜单导航栏跟随
;(function($){
	var followBar = function(group){
		var _this_ = this;
		_this_.group = group;
		var followHTML = '<div class="follow"></div>';
		_this_.group.append(followHTML);
		var follow = _this_.group.find(".follow");
		var width = _this_.group.find("li.active").width(),
			left = _this_.group.find("li.active").position().left;
		follow.css({"left":left,"width":width});
		var timer = null;
		_this_.group.find("li").mouseenter(function(){
			clearTimeout(timer);
			var li = $(this);
			var li_width = li.width(),
				li_left = li.position().left;
				
			follow.css({"left":li_left,"width":li_width})
		});
		_this_.group.mouseout(function(){
			timer = setTimeout(function(){
				follow.css({"left":left,"width":width});
			},350)
		});
	}	
	followBar.init = function(groups){ //初始化函数
		var _this_ = this;
		groups.each(function(){
			new _this_($(this));
		});
	};
	window.followBar = followBar;
})(jQuery);
followBar.init($(".followBar"));



//出场动画
;(function($){
	var cssAnimated = {
			"-webkit-animation-duration":"1s",
			"-moz-animation-duration":"1s",
			"-ms-animation-duration":"1s",
			"-o-animation-duration":"1s",
			"animation-duration":"1s",
			"-webkit-animation-fill-mode":"both",
			"-moz-animation-fill-mode":"both",
			"-ms-animation-fill-mode":"both",
			"-o-animation-fill-mode":"both",
			"animation-fill-mode":"both"
	}
	$.fn.animateIn = function(animate,callback){
		this.each(function(){
			var _this_ = $(this);
			_this_.css(cssAnimated);
			if(_this_.css("opacity")=="1"){
				return;
			}
			_this_.css("opacity",1)
			_this_.addClass(animate);
			setTimeout(function(){
				if(callback && typeof(callback) === "function"){
					callback();
				};
			},1000);
		});
	}
})(jQuery);

$(".panel-heading a").click(function(){
	$(this).addClass("active");
	$(this).siblings().removeClass("active");
});

$("#sales").click(function(){
	$(".sales-body").show();
	$(".shops-body").fadeOut();
});
$("#shops").click(function(){
	$(".sales-body").fadeOut();
	$(".shops-body").show();
});



